<template>
  <div class="userinfo">
    <Navbar :user-img="model.user_img"></Navbar>
    <img alt="背景图片" src="@/assets/bannerTop_new.png">
    <user-detail :userData="model"></user-detail>
  </div>
</template>

<script>
import Navbar from '@/components/common/Navbar'
import UserDetail from '@/components/userComponent/UserDetail'

export default {
  name: 'UserInfo',
  data() {
    return {
      model: {}
    }
  },
  components: {
    Navbar,
    UserDetail
  },
  methods: {
    async getUserData() {
      const res = await this.$http.get('/user/' + localStorage.getItem('id'), {
        headers: {
          'Authorization': 'Bearer ' + localStorage.getItem('token')
        }
      })
      this.model = res.data[0]
    }
  },
  created() {
    this.getUserData()
  }
}
</script>

<style scoped>
.userinfo img {
  height: 26vw;
  width: 100%;
}

</style>
